<?php

namespace Kateba\RestaurantBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

use Kateba\RestaurantBundle\Entity\Food;

/**
 * Food controller.
 *
 */
class FoodController extends Controller
{
    /**
     * Lists all Food entities.
     *
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getEntityManager();

        $entities = $em->getRepository('KatebaRestaurantBundle:Food')->findAll();

        return $this->render('KatebaRestaurantBundle:Food:index.html.twig', array(
            'entities' => $entities
        ));
    }

    /**
     * Finds and displays a Food entity.
     *
     */
    public function showAction($id)
    {
        $em = $this->getDoctrine()->getEntityManager();

        $entity = $em->getRepository('KatebaRestaurantBundle:Food')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Food entity.');
        }

        return $this->render('KatebaRestaurantBundle:Food:show.html.twig', array(
            'entity'      => $entity,
        ));
    }

}
